package leetcode.array;

import java.util.HashSet;
import java.util.Set;

/**
 * @Description: https://leetcode.cn/problems/contains-duplicate/description/
 * @Author Ammar
 * @Create 2023/8/4 15:40
 */
public class _217_存在重复元素 {
    public boolean containsDuplicate(int[] nums) {
        Set<Integer> set = new HashSet<Integer>();
        for (int x : nums) {
            if (!set.add(x)) {
                return true;
            }
        }
        return false;
    }
}
